home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
FromTheMag
/
JW FLV MEDIA PLAYER 4.2
/
mediaplayer.exe
/
player.swf
/
scripts
/
com
/
jeroenwijering
/
parsers
/
ATOMParser.as
< prev
next >
Wrap
Text File
|
2008-11-04
|
3KB
|
81 lines
package com.jeroenwijering.parsers
{
public class ATOMParser extends ObjectParser
{
public function ATOMParser()
{
super();
}
public static function parse(param1:XML) : Array
{
var _loc2_:Array = null;
var _loc3_:Object = null;
var _loc4_:XML = null;
_loc2_ = new Array();
_loc3_ = new Object();
for each(_loc4_ in param1.children())
{
if(_loc4_.localName() == "entry")
{
_loc3_ = ATOMParser.parseItem(_loc4_);
}
if(_loc3_["type"] != undefined)
{
_loc2_.push(_loc3_);
}
_loc3_ = {};
}
return _loc2_;
}
public static function parseItem(param1:XML) : Object
{
var _loc2_:* = undefined;
var _loc3_:XML = null;
var _loc4_:RegExp = null;
var _loc5_:RegExp = null;
var _loc6_:String = null;
_loc2_ = new Object();
for each(_loc3_ in param1.children())
{
switch(_loc3_.localName())
{
case "author":
_loc2_["author"] = _loc3_.children()[0].text().toString();
break;
case "title":
_loc2_["title"] = _loc3_.text().toString();
break;
case "summary":
_loc2_["description"] = _loc3_.text().toString();
break;
case "link":
if(_loc3_.@rel == "alternate")
{
_loc2_["link"] = _loc3_.@href.toString();
}
else
{
_loc4_ = /^(.+)#(.+)$/g;
_loc5_ = /^(.+)\.(.+)$/g;
_loc6_ = _loc3_.@rel.toString().replace(_loc4_,"$2").replace(_loc5_,"$2");
_loc2_[_loc6_] = _loc3_.@href.toString();
}
break;
case "published":
_loc2_["date"] = _loc3_.text().toString();
break;
case "group":
_loc2_ = MediaParser.parseGroup(_loc3_,_loc2_);
break;
}
}
_loc2_ = MediaParser.parseGroup(param1,_loc2_);
return ObjectParser.complete(_loc2_);
}
}
}